import Login from "@/pages/login/index.jsx";
import Layout from "@/pages/layout/index.jsx";
import { HashRouter, Routes, Route, Link, useRoutes } from "react-router-dom";
import { Provider } from "react-redux";
import store from "@/store/index";

import Permission from '@/Permission'



//配置二级路由 
// import Dashboard from "@/pages/dashboard/index.jsx";
// import GoodForm from "@/pages/good/goodform";
// import GoodList from "@/pages/good/goodList";
// import User from "@/pages/user";

// import { asyncRoutes } from "@/pages/index.jsx";
// import { element } from "prop-types";
// import { useRoute } from "vue-router/types/composables";

function createRoutes(accessRoutes) {
    let result = [];
    accessRoutes.forEach(route => {
        if (route.path && route.element) {
            result.push(
                <Route key={route.key} path={route.path} element={route.element}></Route>
            )
        }
        if (route.children) {
            route.children.forEach(route => {
                result.push(
                    <Route key={route.key} path={route.path} element={route.element}></Route>
                )
            })
        }

    });
    return result;
}



function App() {
    return (
        <HashRouter>
            <Provider store={store}>

                <Permission />
                {/* <Routes>
                    <Route path='/' element={<Layout />}> */}

                {
                    //是所有的路由规则
                    // createRoutes(asyncRoutes)
                }
                {/* </Route>
                    <Route path='/login' element={<Login />}></Route>
                </Routes> */}
            </Provider>
        </HashRouter>
    )
}
export default App;
